package com.example.mybiadushoujiweishi.activity.acivitys.fragments;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import butterknife.ButterKnife;
import butterknife.Unbinder;

/**
 * Created by Administrator on 2017/5/26 0026.
 */

public abstract class Fragmentbase extends Fragment {
private View view;
    Unbinder unbinder;

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        if (view==null) {
            view = inflater.inflate(getXml(), container, false);
        }
        unbinder=ButterKnife.bind(this,view);
        initView();
        initData();
        return view;
    }

    public abstract int getXml();

    public abstract void initView();

    public abstract void initData();

    @Override
    public void onDestroy() {
        super.onDestroy();
        if(unbinder!=null)
        {
            unbinder.unbind();
        }
    }
}
